<?
$tmppath="../../";
REQUIRE ($tmppath."include/login.php");
REQUIRE ($tmppath."$templates/up.php");
REQUIRE($tmppath."protect/connect.php");

require("../fonction.php");
TITRE_JEU("Visionner votre alliance");

$query ="SELECT alliance_name,alliance_date_crea, alliance_description,alliance_charte,alliance_cacher,alliance_createur,alliance_site,alliance_icon,alliance_ami, alliance_ennemis,alliance_tresort FROM sdalliance WHERE alliance_id=$alliance";
$resultat=mysql_query($query);
$row = mysql_fetch_array($resultat);
$nom =$row[0];			
$date=$row[1];
$description=$row[2];
$charte=$row[3];
$cacher=$row[4];
$createur=$row[5];
$web=$row[6];
$icon=$row[7];
$ami=$row[8];
$ennemis=$row[9];
$tresor=$row[10];



  $dtmp=$date;
   $date=substr($dtmp,6,2)."-". substr($dtmp,4,2)."-". substr($dtmp,0,4);
    

$description=htmlentities($description);
$description=nl2br($description);
$charte=htmlentities($charte);
$charte=nl2br($charte);

$query ="SELECT perso_name FROM sduser_perso WHERE perso_id=$createur";
$resultat=mysql_query($query);
$row = mysql_fetch_array($resultat);
$createur=$row[0];
//-----


$query ="SELECT count(*) FROM sduser_perso WHERE perso_alliance=$alliance";
$resultat=mysql_query($query);
$row = mysql_fetch_array($resultat);
$nbr_inscrit=$row[0];


$lien2="window.open('../../include_l.php?p=vis_alliance&alliance=$alliance&$SID', 'unite', 'scrollbars=yes,status=no,top=0,left=0,width=430,height=500,copyhistory=0')";


?>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="56%"><div align="center"> 
              <table width="99%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000" >
                <tr> 
                  <td  background="../../templates/default/FondS.jpg"><div align="center"></div>
                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
                      <tr background="../../templates/default/FondC.jpg"> 
                        <td width="100%" background="../../templates/default/FondS.jpg"> 
                          <div align="center"><strong><em><font color="#FFFF00" size="4">Blason.</font></em></strong></div></td>
                      </tr>
                      <tr background="../../templates/default/Fond.jpg"> 
                        <td background="../../templates/default/Fond.jpg"><div align="right"> 
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr> 
                                <td> <div align="right"></div>
                                  <font size="2">
<?
//Si le blason est vide
IF (empty($icon)){
	Echo"<CENTER>Pas d'image</CENTER>";
}
//Sinon
ELSE{
ECHO"<CENTER><img src=\"$icon\"></CENTER>";

}

?>
								  </font></td>
                              </tr>
                            </table>
                          </div></td>
                      </tr>
                    </table></td>
                </tr>
              </table>
            </div>
            
          </td>
          <td width="44%"><div align="center">
              <table width="99%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000" >
                <tr> 
                  <td  background="../../templates/default/FondS.jpg"><div align="center"></div>
                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
                      <tr background="../../templates/default/FondC.jpg"> 
                        <td width="100%" background="../../templates/default/FondS.jpg"> 
                          <div align="center"><strong><em><? echo "<font color=\"#FFFF00\" size=\"4\">$nom</font> "; ?></em></strong></div></td>
                      </tr>
                      <tr background="../../templates/default/Fond.jpg"> 
                        <td background="../../templates/default/Fond.jpg"><div align="right"> 
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr> 
                                <td width="54%"><div align="right"><font color="#CCCCCC" size="2">Nom 
                                    du g&eacute;rant</font></div></td>
                                <td width="46%"><font size="2"> &nbsp;<? echo $createur; ?> 
                                  </font></td>
                              </tr>
                              <tr> 
                                <td><div align="right"><font color="#CCCCCC" size="2">Date 
                                    de cr&eacute;ation:</font></div></td>
                                <td><font size="2">&nbsp;<? echo $date; ?></font></td>
                              </tr>
                              <tr> 
                                <td><div align="right"><font color="#CCCCCC" size="2">Site 
                                    Web :</font></div></td>
                                <td><font size="2">&nbsp; 
                                  <? 
								
								IF (!empty($web)){
									echo "<a href=\"$web\" target=\"_blanck\">Site de l'alliance</a>";
								}
								 
								
								?>
                                  </font></td>
                              </tr>
                              <tr> 
                                <td><div align="right"><font color="#CCCCCC" size="2">Cacher 
                                    :</font></div></td>
                                <td><font size="2">&nbsp;
                                  <? IF ($cacher==1){echo "cacher";}ELSE{ ECHO"Non cacher"; } ?>
                                  </font></td>
                              </tr>
                              <tr>
                                <td><div align="right"><font color="#CCCCCC" size="2">Tr&eacute;sort 
                                    : </font></div></td>
                                <td><font size="2"><? echo $tresor; ?> Lorins</font></td>
                              </tr>
                            </table>
                          </div></td>
                      </tr>
                    </table></td>
                </tr>
              </table>
            </div>
            
          </td>
        </tr>
      </table>
      <div align="center"><img src="../../templates/default/ligne.png" width="390" height="35"> 
      </div>
      <table width="99%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000" >
        <tr> 
          <td  background="../../templates/default/FondS.jpg"><div align="center"></div>
            <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
              <tr background="../../templates/default/FondC.jpg"> 
                <td width="100%" background="../../site/templates/default/FondS.jpg"> 
                  <div align="center">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr> 
                        <td> <div align="center"><strong><em><font color="#FFFF00" size="4">Description.</font></em></strong></div>
                          </td>
                      </tr>
                    </table>
                    <strong><em></em></strong></div></td>
              </tr>
              <tr background="../../templates/default/Fond.jpg"> 
                <td background="../../templates/default/Fond.jpg"><div align="right"> 
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr> 
                        <td colspan="2"><div align="justify"><font size="2"><? echo "$description"; ?></font></div></td>
                      </tr>
                    </table>
                  </div></td>
              </tr>
            </table></td>
        </tr>
      </table> 
      <div align="center"><img src="../../templates/default/ligne.png" width="390" height="35"> 
      </div>
      <table width="99%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000" >
        <tr> 
          <td  background="../../templates/default/FondS.jpg"><div align="center"></div>
            <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
              <tr background="../../templates/default/FondC.jpg"> 
                <td width="100%" background="../../site/templates/default/FondS.jpg"> 
                  <div align="center">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr> 
                        <td> <div align="center"><strong><em><font color="#FFFF00" size="4">Charte.</font></em></strong></div>
                          </td>
                      </tr>
                    </table>
                    <strong><em></em></strong></div></td>
              </tr>
              <tr background="../../templates/default/Fond.jpg"> 
                <td background="../../templates/default/Fond.jpg"><div align="right"> 
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr> 
                        <td colspan="2"><div align="justify"><font size="2"><? echo "$charte"; ?></font></div></td>
                      </tr>
                    </table>
                  </div></td>
              </tr>
            </table></td>
        </tr>
      </table> 
      <div align="center"><img src="../../templates/default/ligne.png" width="390" height="35"> 
      </div>
      <div align="center"> </div>
      <table width="90%" border="0" align="center">
        <tr>
          <td width="54%"><table width="99%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000" >
              <tr> 
                <td  background="../../templates/default/FondS.jpg"><div align="center"></div>
                  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
                    <tr background="../../templates/default/FondC.jpg"> 
                      <td width="100%" background="../../site/templates/default/FondS.jpg"> 
                        <div align="center"> 
                          <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr> 
                              <td> <div align="center"><strong><em><font color="#FFFF00" size="4">Ami 
                                  de l'alliance</font> </em></strong></div></td>
                            </tr>
                          </table>
                          <strong><em></em></strong></div></td>
                    </tr>
                    <tr background="../../templates/default/Fond.jpg"> 
                      <td background="../../templates/default/Fond.jpg"><div align="right"> 
                          <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr> 
                              <td colspan="2"><div align="justify"><font size="2"><? echo $ami; ?></font> 
                                </div></td>
                            </tr>
                          </table>
                        </div></td>
                    </tr>
                  </table></td>
              </tr>
            </table></td>
          <td width="46%"><table width="99%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000" >
              <tr> 
                <td  background="../../templates/default/FondS.jpg"><div align="center"></div>
                  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
                    <tr background="../../templates/default/FondC.jpg"> 
                      <td width="100%" background="../../site/templates/default/FondS.jpg"> 
                        <div align="center"> 
                          <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr> 
                              <td> <div align="center"><strong><em><font color="#FFFF00" size="4">Ennemis 
                                  de l'alliance</font> </em></strong></div></td>
                            </tr>
                          </table>
                          <strong><em></em></strong></div></td>
                    </tr>
                    <tr background="../../templates/default/Fond.jpg"> 
                      <td background="../../templates/default/Fond.jpg"><div align="right"> 
                          <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr> 
                              <td colspan="2"><div align="justify"><font size="2"><? echo $ennemis; ?></font> 
                                </div></td>
                            </tr>
                          </table>
                        </div></td>
                    </tr>
                  </table></td>
              </tr>
            </table></td>
        </tr>
      </table>
      <div align="center"><img src="../../templates/default/ligne.png" width="390" height="35"><br>
      </div>
      <table width="99%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000" >
        <tr> 
          <td  background="../../templates/default/FondS.jpg"><div align="center"></div>
            <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
              <tr background="../../templates/default/FondC.jpg"> 
                <td width="100%" background="../../site/templates/default/FondS.jpg"> 
                  <div align="center"> 
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr> 
                        <td> <div align="center"><strong><em><font color="#FFFF00" size="4">Inscrit 
                            (</font><font color="#FFFF00" size="4"><? echo $nbr_inscrit; ?>)</font> 
                            </em></strong></div></td>
                      </tr>
                    </table>
                    <strong><em></em></strong></div></td>
              </tr>
              <tr background="../../templates/default/Fond.jpg"> 
                <td background="../../templates/default/Fond.jpg"><div align="right"> 
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr> 
                        <td colspan="2"><div align="justify"> 
                            <?
//Les participant.
$query="SELECT perso_name,perso_race,perso_classe FROM sduser_perso WHERE perso_alliance=$alliance";
//0=ID, 1=Population, 2=taux nutrition, 3= regime alimentaire, 4=stock.
$resultat=mysql_query($query);


WHILE ($element=mysql_fetch_array($resultat)){

echo" <tr><td width=\"50%\"><div align=\"right\"><font size=\"2\"> $element[0]</font></div></td><td width=\"50%\"><font size=\"2\">-</font></td></tr>";


}//Fin du while element.
?>
                          </div></td>
                      </tr>
                    </table>
                  </div></td>
              </tr>
            </table></td>
        </tr>
      </table>
      <div align="center"><img src="../../templates/default/ligne.png" width="390" height="35"> 
      </div> 
      </td>
  </tr>
</table>
</body>
</html>
